package com.example.cloudprinter.printer.yilianyun.format;

import com.example.cloudprinter.printer.IFormat;

/**
 * 易联云打印机指令格式
 */
public class YilianYunFormat implements IFormat {

    /**
     * 内容居中
     *
     * @param content
     * @return
     */
    @Override
    public String center(String content) {
        return "<center>" + content + "</center>";
    }

    /**
     * 内容居左
     *
     * @param content
     * @return
     */
    @Override
    public String left(String content) {
        return content;
    }

    /**
     * 内容居右
     *
     * @param content
     * @return
     */
    @Override
    public String right(String content) {
        return "<right>" + content + "</right>";
    }

    /**
     * 字体加粗
     *
     * @param content
     * @return
     */
    @Override
    public String bold(String content) {
        return "<FB>" + content + "</FB>";
    }

    /**
     * 字体加大
     *
     * @param content
     * @return
     */
    @Override
    public String big(String content) {
        return "<FS>" + content + "</FS>";
    }

    /**
     * 1行3列
     *
     * @param colunm1
     * @param colunm2
     * @param column3
     * @param isChinese 是否全是中文
     * @return
     */
    @Override
    public String threeColunm(String colunm1, String colunm2, String column3, boolean isChinese) {
        return "<table><tr><td>" + colunm1
                + "</td><td>" + colunm2
                + "</td><td>" + column3
                + "</td></tr></table>";
    }

    /**
     * 换行
     *
     * @param lines 行数
     * @return
     */
    @Override
    public String newline(int lines) {
        String content = "";
        for (int i = 0; i < lines; i++)
            content += "\n";
        return content;
    }
}
